aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/(profile)
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-09 15:54:22 -0700
committerAdam Soltys <[email protected]>2024-09-17 09:18:36 -0700
commit9c4816e3a9acb8e917cf3a034a8622d9026632a6 (patch)
tree8f02d08bca7d03dcd2e10517dfa31c21f7b90607 /src/routes/(app)/[username]/(profile)
parentc270fa28572f08499120ac9d5f58852869d4b254 (diff)
downloadcoinos-ui-9c4816e3a9acb8e917cf3a034a8622d9026632a6.tar.gz
coinos-ui-9c4816e3a9acb8e917cf3a034a8622d9026632a6.zip
accounts
Diffstat (limited to 'src/routes/(app)/[username]/(profile)')
-rw-r--r--src/routes/(app)/[username]/(profile)/+page.server.ts5
-rw-r--r--src/routes/(app)/[username]/(profile)/+page.svelte20
2 files changed, 17 insertions, 8 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+page.server.ts b/src/routes/(app)/[username]/(profile)/+page.server.ts
index 59eb44d5..9c9be68a 100644
--- a/src/routes/(app)/[username]/(profile)/+page.server.ts
+++ b/src/routes/(app)/[username]/(profile)/+page.server.ts
@@ -4,8 +4,11 @@ export async function load({ cookies, depends, parent }) {
depends("app:items");
let { subject } = await parent();
+
+ let accounts = await get("/accounts", auth(cookies));
+
let items = await get(`/${subject.id}/items`, auth(cookies));
items.map((i) => (i.quantity = 0));
- return { items };
+ return { accounts, items };
}
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte
index 7c0de9d8..25244c6d 100644
--- a/src/routes/(app)/[username]/(profile)/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/+page.svelte
@@ -9,7 +9,7 @@
export let data;
- let { subject, user, items, rates } = data;
+ let { accounts, subject, user, items, rates } = data;
$: ({ currency } = subject);
$: rate = rates[currency];
$: total = items.reduce((a, b) => a + b.price * b.quantity, 0);
@@ -24,11 +24,6 @@
};
if (user) user.savings = 0;
-
- let accounts = [
- { balance: user.balance, setup: true, type: "Cash" },
- { id: "pubtest", balance: user.savings, setup: !!user.seed, type: "Savings" },
- ];
</script>
{#if !user.balance}
@@ -39,12 +34,23 @@
</div>
{/if}
-<div class="space-y-5">
+<div class="space-y-2">
{#if user?.id === subject.id}
{#each accounts as account}
<Account {user} {rate} {account} />
{/each}
+ <button
+ class="rounded-2xl border py-5 px-6 font-bold hover:opacity-80 flex bg-black text-white"
+ >
+ <a href={`/${user.username}/account/setup`}>
+ <div class="mx-auto flex gap-2">
+ <Icon icon="plus" style="w-8 mx-auto invert" />
+ <div class="my-auto text-xl whitespace-nowrap">Add account</div>
+ </div>
+ </a>
+ </button>
+
{#if $installPrompt}
<button
class="rounded-2xl border py-5 px-6 font-bold hover:opacity-80 flex bg-black text-white grow basis-full fixed bottom-16 xl:hidden"